<template>
  <DataList :cate="cate" :cols="cols" :single="true" :name="name"/>
</template>
<script>
import DataList from "@/components/DataList";
import { getUser } from "@/utils/auth";
import { addJfsrmx4,deleteJfsrmx4,updateJfsrmx4,getJfsrmx4} from "@/api/其他收入.js";
export default {
  components: {
    DataList
  },
  data() {
    return {
      cate: "A5-1-4其他收入",
      name:'5.1.4 其他收入',
      cols: [
        { label: "社会捐赠金额(万元)", prop: "SHJZJE" },
        { label: "其他收入总额(万元)", prop: "QTSRZE" },
        { label: "贷款金额(万元)", prop: "DKJE" },
        { label: "贷款余额(万元)", prop: "DKYE" },
      ]
    };
  },
  methods: {
    async fetchData() {
      var user = getUser();
      var datas = await getJfsrmx4(user.XXID,user.CJPC);
      return datas;
    },
    onadd(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
      
          console.log(JSON.stringify(temp));
          var model = await addJfsrmx4(temp);
          resolve(model);
      })
      
    },
    onupdate(model) {
      //
      var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
           
          console.log(JSON.stringify(temp));
          var model = await updateJfsrmx4(temp);
          resolve(model);
      })
      //
    },
    ondelete(model) {
       var temp = JSON.parse(JSON.stringify(model))
      return new Promise(async (resolve,reject)=>{
        
         await deleteJfsrmx4(temp);
          resolve();
      })
    }
  }
};
</script>
<style>
</style>